import os
from django.test import TestCase

# Create your tests here.
from itsdangerous import TimedJSONWebSignatureSerializer
from django.conf import settings

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "meiduo_mall.settings.dev")  # 新的开发环境配置文件

if __name__ == '__main__':
    s=TimedJSONWebSignatureSerializer(settings.SECRET_KEY,expires_in=300)
    dict={
        'name':'zs'
    }

    token=s.dumps(dict)
    print(token)
    access_token=token.decode()
    print('加密为：',access_token)#加密

    at=s.loads(access_token)
    print('解密为：',at )